home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------
- //
- // This code is copyright 2001 by G5 Software.
- // Any unauthorized usage, either in part or in whole of this code
- // is strictly prohibited. Violators WILL be prosecuted to the
- // maximum extent allowed by law.
- //
- //-------------------------------------------------------------------
-
- ///////////////////////////////////
- //
- // Mission 10 -- Intercept Convoy
- //
- ///////////////////////////////////
-
- class CMission10_AIController extends CBaseAIController
- {
- array ActivatePointCenterList = array(
- vector( 3405, 2510, 0), // First Base A
- vector( 3120, 4670, 0), // B
- vector( 6040, 5875, 0), // C
- vector( 3435, 7350, 0), // D
- vector( 6590, 9280, 0), // E
- vector( 2995, 9825, 0), // F
- vector( 3410, 12645, 0), // G
- vector( 3390, 13365, 0), // H
- vector( 8185, 4480, 0), // I
- vector( 9030, 3925, 0)); // J
-
-
- array ActivatePointRadiusList = array(
- 50.0, // radius of "ring is broken"
- 50.0,
- 50.0,
- 50.0,
- 50.0,
- 50.0,
- 50.0,
- 50.0,
- 50.0,
- 50.0);
-
- array ActivatePointNameList = array(
- "",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J"
- );
-
- void OnObjectEnterArea( int _AreaIndex, string _NavPointName, string _ObjectID)
- {
- if ( _AreaIndex == 7
- && Core_IsStringStartsWith( _ObjectID, "10_NaziConv_A"))
- {
- Core_BroadcastEvent("OnConvoyAStop");
- // Core_LogMessage("Camera shows: Convoy A in AreaIndex 7");
- // Core_SendEventTo(
- // "Helicopter",
- // "ShowEventPoint",
- // vector(3390, 13365, 0), // - point to show
- // 80.0 // - distance from camera to point
- // );
- };
- if ( _AreaIndex == 9
- && Core_IsStringStartsWith( _ObjectID, "10_NaziConv_B"))
- {
- Core_BroadcastEvent("OnConvoyBStop");
- // Core_LogMessage("Camera shows: Convoy B in AreaIndex 9");
- // Core_SendEventTo(
- // "Helicopter",
- // "ShowEventPoint",
- // vector(9030, 3925, 0), // - point to show
- // 80.0 // - distance from camera to point
- // );
- }
- }
- }
-
- class C10_NaziConv_A extends CNavPointUser, CBaseAITask_BaseTask
- {
- //
- // convoy parameters
-
- vector DestinationPoint;// = vector( 3390, 13365, 0);//vector( 3390, 13365, 0); // where to go
- float CruiserSpeed = 30; // autocade with guard should keep this speed
- float RunSpeed = 30; // autocade wo guards should keep this speed
- float OvertakeSpeed = 34; // maximum allowed speed for overtake
- float AutocadDistanceMin = 20; // nearest allowed distance in autocade
- float AutocadDistanceOptimum = 25; // try to keep this distance in autocade
- float AutocadDistanceOvertake = 40; // overtake distance
- string CurLeader = "";
- boolean IsLeader = false;
-
-
- //
- // current state
-
- boolean Moving = false; // true when object is moving to destination
- boolean Ambushed = false; // true when object is under ambush
- boolean Retreat = false; // true when object is retreating
- boolean Run = false; // true when object is running without stop to destination
-
- int StartTime = 0;
- int TimeContinuous = 5000;
- boolean MovingStatus = false;
-
- void OnConvoyAStop()
- {
- // SetOrder_StopNow();
- // Core_BroadcastEvent(
- // "OnDisplayMessage",
- // "Mission Failed. Convoy reach the Nordgeimer base",
- // StructureDestroyedColor
- // );
- // Core_BroadcastEvent("NeedToQuit");
- }
-
- void ClearState()
- {
- Moving = false;
- Ambushed = false;
- Retreat = false;
- Run = false;
- CurLeader = "";
- IsLeader = false;
- }
-
- //
- // start up initialization
-
- void Init()
- {
- DestinationPoint = vector( 3390, 13365, 0);
- StartTime = GetGameTime();
- // give start order
- //GiveOrder_MoveToTarget();
- }
-
- void OnUpdate()
- {
- if ( (StartTime != 0) && ( (GetGameTime() - StartTime) > TimeContinuous ) && ( !MovingStatus ) )
- {
- GiveOrder_MoveToTarget();
- Core_BroadcastEvent("OnConvoyAStart");
- // Core_LogMessage("Camera shows: Convoy A after moving start. Unit 02");
- // Core_SendEventTo(
- // "Helicopter",
- // "ShowEventObject",
- // "10_NaziConv_A_02", // - id of object to show
- // 70.0 // - distance from camera to object
- // );
- MovingStatus = true;
- }
- }
-
-
- //
- // orders
-
- void GiveOrder_MoveToTarget()
- {
- //Core_LogMessage("" + Core_GetIdentificator() + ": order: move to target");
-
- string Leader = GetCommander("ConvA_Rank"); // find leader that we should followed by
- if ( Moving == true
- && Leader == CurLeader)
- {
- // nothing changed
- return;
- }
-
- // set state
- ClearState();
- Moving = true;
- CurLeader = Leader;
-
- if ( Leader == "")
- {
- // we are leader. go directly to destination
- SetOrder_MoveTo(
- DestinationPoint,
- CruiserSpeed);
- }
- else
- {
- // leader found. follow him
- SetOrder_Follow(
- Leader, // follow leader
- AutocadDistanceMin,
- AutocadDistanceOptimum,
- AutocadDistanceOvertake,
- CruiserSpeed,
- OvertakeSpeed);
- };
- }
-
- void OnLeaderLost( string _LeaderID)
- {
- // reorder
- GiveOrder_MoveToTarget();
- }
- };
-
- class C10_NaziConv_B extends CNavPointUser, CBaseAITask_BaseTask
- {
- //
- // convoy parameters
-
- vector DestinationPoint;// = vector( 9030, 3925, 0);//vector( 9030, 3925, 0); // where to go
- float CruiserSpeed = 30; // autocade with guard should keep this speed
- float RunSpeed = 30; // autocade wo guards should keep this speed
- float OvertakeSpeed = 34; // maximum allowed speed for overtake
- float AutocadDistanceMin = 20; // nearest allowed distance in autocade
- float AutocadDistanceOptimum = 25; // try to keep this distance in autocade
- float AutocadDistanceOvertake = 40; // overtake distance
- string CurLeader = "";
- boolean IsLeader = false;
-
-
- //
- // current state
-
- boolean Moving = false; // true when object is moving to destination
- boolean Ambushed = false; // true when object is under ambush
- boolean Retreat = false; // true when object is retreating
- boolean Run = false; // true when object is running without stop to destination
-
- int StartTime = 0;
- int TimeContinuous = 10000;
- boolean MovingStatus = false;
-
- void OnConvoyBStop()
- {
- SetOrder_StopNow();
- // Core_BroadcastEvent(
- // "OnDisplayMessage",
- // "Mission Failed. Convoy reach the Titovo village",
- // StructureDestroyedColor
- // );
- // Core_BroadcastEvent("NeedToQuit");
- }
-
- void ClearState()
- {
- Moving = false;
- Ambushed = false;
- Retreat = false;
- Run = false;
- CurLeader = "";
- IsLeader = false;
- }
-
- //
- // start up initialization
-
- void Init()
- {
- DestinationPoint = vector( 9030, 3925, 0);
- StartTime = GetGameTime();
- // give start order
- // GiveOrder_MoveToTarget();
- }
-
- void OnUpdate()
- {
- if ( (StartTime != 0) && ( (GetGameTime() - StartTime) > TimeContinuous ) && ( !MovingStatus ) )
- {
- GiveOrder_MoveToTarget();
- MovingStatus = true;
- Core_BroadcastEvent("OnConvoyBStart");
- // Core_LogMessage("Camera shows: Convoy B after moving start. Unit 02");
- // Core_SendEventTo(
- // "Helicopter",
- // "ShowEventObject",
- // "10_NaziConv_B_02", // - id of object to show
- // 70.0 // - distance from camera to object
- // );
- }
- }
-
- //
- // orders
-
- void GiveOrder_MoveToTarget()
- {
- //Core_LogMessage("" + Core_GetIdentificator() + ": order: move to target");
-
- string Leader = GetCommander("ConvB_Rank"); // find leader that we should followed by
- if ( Moving == true
- && Leader == CurLeader)
- {
- // nothing changed
- return;
- }
-
- // set state
- ClearState();
- Moving = true;
- CurLeader = Leader;
-
- if ( Leader == "")
- {
- // we are leader. go directly to destination
- SetOrder_MoveTo(
- DestinationPoint,
- CruiserSpeed);
- }
- else
- {
- // leader found. follow him
- SetOrder_Follow(
- Leader, // follow leader
- AutocadDistanceMin,
- AutocadDistanceOptimum,
- AutocadDistanceOvertake,
- CruiserSpeed,
- OvertakeSpeed);
- };
- }
-
- void OnLeaderLost( string _LeaderID)
- {
- // reorder
- GiveOrder_MoveToTarget();
- }
- }
- ///======================================================================
-
- class C10_NaziCross extends CBaseAITask_BaseTask
- {
- void OnEnemyTargeted()
- {
- // StartTime = GetGameTime();
- Core_BroadcastEvent( "WarningDetected" );
- }
- void Unit_Destroyed( string ObjectID )
- {
- if ( Core_IsStringStartsWith( ObjectID, GetUnitPrefix() ))
- {
- Core_BroadcastEvent( "CrossroadAttacked" );
- }
- }
- }
- ///--------------------------------------------
- class C10_NaziCross_A extends C10_NaziCross
- {
- string GetUnitPrefix()
- {
- return "10_NaziCross_A";
- }
- }
- //---------------------------------------------
- class C10_NaziCross_B extends C10_NaziCross
- {
- string GetUnitPrefix()
- {
- return "10_NaziCross_B";
- }
- }
- //---------------------------------------------
- class C10_NaziCross_C extends C10_NaziCross
- {
- string GetUnitPrefix()
- {
- return "10_NaziCross_C";
- }
- }
- ///=======================================================================
- class C10_NaziSinglePatrol extends CNavPointUser, CBaseAITask_BaseTask
- {
- //
- // convoy parameters
-
- vector DestinationPoint = vector( 7300, 4445, 0); // where to go
- float CruiserSpeed = 27; // autocade with guard should keep this speed
- float RunSpeed = 28; // autocade wo guards should keep this speed
- float OvertakeSpeed = 30; // maximum allowed speed for overtake
- float AutocadDistanceMin = 20; // nearest allowed distance in autocade
- float AutocadDistanceOptimum = 25; // try to keep this distance in autocade
- float AutocadDistanceOvertake = 35; // overtake distance
- string CurLeader = "";
- boolean IsLeader = false;
-
-
- //
- // current state
-
- boolean Moving = false; // true when object is moving to destination
- boolean Run = false; // true when object is running without stop to destination
-
- // int StartTime = 0;
- // int TimeContinuous = 2000;
- // boolean MovingStatus = false;
-
- void ClearState()
- {
- Moving = false;
- Run = false;
- CurLeader = "";
- IsLeader = false;
- }
-
- //
- // start up initialization
-
- void Init()
- {
- DestinationPoint = vector( 7300, 4445, 0);
- // give start order
- GiveOrder_MoveToTarget();
- }
-
- //
- // orders
-
- void GiveOrder_MoveToTarget()
- {
- //Core_LogMessage("" + Core_GetIdentificator() + ": order: move to target");
-
- string Leader = GetCommander(GetGroupName()); // find leader that we should followed by
- if ( Moving == true
- && Leader == CurLeader)
- {
- // nothing changed
- return;
- }
-
- // set state
- ClearState();
- Moving = true;
- CurLeader = Leader;
-
- if ( Leader == "")
- {
- // we are leader. go directly to destination
- SetOrder_MoveTo(
- DestinationPoint,
- CruiserSpeed);
- }
- else
- {
- // leader found. follow him
- SetOrder_Follow(
- Leader, // follow leader
- AutocadDistanceMin,
- AutocadDistanceOptimum,
- AutocadDistanceOvertake,
- CruiserSpeed,
- OvertakeSpeed);
- };
- }
-
- void OnLeaderLost( string _LeaderID)
- {
- // reorder
- GiveOrder_MoveToTarget();
- }
- }
- ///------------------------------------------------------------------------------------
- class C10_NaziPatrol_A extends C10_NaziSinglePatrol
- {
- string GetGroupName()
- {
- return "Rank_PatrolA";
- }
-
- void Init()
- {
- DestinationPoint = vector( 7300, 5445, 0);
- // give start order
- GiveOrder_MoveToTarget();
- }
- }
- ///-----------------------------------------------------------------------------------------------
- class C10_CrossA_Patrol extends C10_NaziSinglePatrol
- {
- string GetGroupName()
- {
- return "Rank_PatrolCrossA";
- }
-
- void Init()
- {
- DestinationPoint = vector( 6035, 5870, 0);
- // give start order
- GiveOrder_MoveToTarget();
- }
- }
- ///---------------------------------------------------------------------------------------------
- class C10_SharkPatrol extends C10_NaziSinglePatrol
- {
- string GetGroupName()
- {
- return "Rank_SharkPatrol";
- }
-
- void Init()
- {
- DestinationPoint = vector( 7130, 7553, 0);
- // give start order
- GiveOrder_MoveToTarget();
- }
- }
-
- /// ==========================================================================================
- class C10_Patrol_Tit_CrossA extends CNavPointUser, CBaseAITask_Patrol
- {
- array GetPatrolTrip()
- {
- return array (vector(8185,4480,0),
- vector(6040,5875,0));
- }
-
- float GetTripSpeed()
- {
- return 20;
- }
- }
- ///-------------------------------------------------------------------------------------------
- class C10_Patrol_CrossA_CrossB extends CNavPointUser, CBaseAITask_Patrol
- {
- array GetPatrolTrip()
- {
- return array (vector(3435,7350,0),
- vector(6045,5875,0));
- }
-
- float GetTripSpeed()
- {
- return 20;
- }
- }
- /// ------------------------------------------------------------------------------------------
- class C10_Patrol_CrossB_CrossC extends CNavPointUser, CBaseAITask_Patrol
- {
- array GetPatrolTrip()
- {
- return array (vector(3435,7355,0),
- vector(6590,9280,0));
- }
-
- float GetTripSpeed()
- {
- return 20;
- }
- }
- // =================================================
- class C10_NaziTitovo extends CNavPointUser, CBaseAITask_BaseTask, CBaseAITask_Patrol
- {
- }
-
-
-